<?php 

// +----------------------------------------------------------------------
// | 文件 Oss.class.php
// +----------------------------------------------------------------------
// | 说明 OSS管理
// +----------------------------------------------------------------------
// | 
// +----------------------------------------------------------------------
// | Author: 谢赤心 Legend. <xcx_legender@qq.com>
// +----------------------------------------------------------------------

namespace Common\Util\aliyun;
 

class Oss
{
	const OSS_HOST = 'oss-cn-qingdao.aliyuncs.com';

    /**
     * 上传文件根目录
     * @var string
     */
    private $rootPath;

    /**
     * 上传错误信息
     * @var string
     */
    private $error  = '';
    private $config = array(
        'access_id'  => '', //阿里云Access Key ID
        'access_key' => '', //阿里云Access Key Secret
        'bucket'     => '', //空间名称
        'timeout'    => 90, //超时时间
    );

    /**
     * 构造函数，用于设置上传根路径
     * @param array  $config FTP配置
     */
    public function __construct($rootPath, $config) {
        /* 默认FTP配置 */
        $this->rootPath = $rootPath;
        $this->config = array_merge($this->config, $config);
    }


    public function delObject($bucket, $file)
    {
    	
    }


    private function hex_to_base64($str) {
        $result = '';

        for ($i = 0; $i < strlen($str); $i += 2) {
            $result .= chr(hexdec(substr($str, $i, 2)));
        }

        return base64_encode($result);
    }




}



